Component({
  properties: {

  },
  attached(){
   
  },

 
  data: {
    selected:0,
    tabList:[
      {
        "pagePath": "pages/news/news",
        "text": "资讯",
      },
      {
        "pagePath": "pages/jinbi/jinbi",
        "text": "赚金币"
      },
      {
        "pagePath": "pages/my/my",
        "text": "我的"
      }
    ]
  },
  methods: {
    switchTab(e){
      let key = Number(e.currentTarget.dataset.index);
      let tabList = this.data.tabList;
      let selected = this.data.selected;

      if(selected !== key){
        this.setData({
          selected:key
        });
        wx.switchTab({
          url: `/${tabList[key].pagePath}`,
        })
      }
    }
  }
})

